package
{
   import casts.GenericPauseResumeMovieClip;
   
   import flash.display.BitmapData;
   import flash.display.DisplayObject;
   import flash.display.DisplayObjectContainer;
   import flash.display.MovieClip;
   
   import jp.progression.Progression;
   import jp.progression.casts.CastDocument;
   import jp.progression.casts.getInstanceById;
   import jp.progression.commands.display.AddChild;
   import jp.progression.commands.display.RemoveChild;
   import jp.progression.getManagerById;
	
	public class DEF
	{

      // --------------------- LINE ---------------------
      // facebook 區

      // app id
      public static var APP_ID:String = '152204381520601'; // my test app-id
      public static var PERMISSION:String = 'user_about_me,user_birthday,user_photos,email,read_friendlists,publish_stream';
      // 活動名稱(創相簿、上傳照片…用)
      public static var APP_NAME:String = '測試頁';
      // 活動網址
      public static var CAMPAIGN_URL:String = 'http://aaa/';
      // app 名字
      public static var CANVAS_ID:String = 'null';
      // 認證 url
      public static function get AUTHORIZATION_URL():String { return 'https://www.facebook.com/dialog/oauth?client_id=' + APP_ID + '&redirect_uri=http://apps.facebook.com/' + CANVAS_ID + '/&scope=' + PERMISSION; }
      // 個資(/me/profile回來的資料)
      public static var profile:Object;
      
      // --------------------- LINE ---------------------
      
      public static var BASE_URL:String = '';

      // --------------------- LINE ---------------------

      // post data
      public static var username:String; // usr name
      public static var tel:String; // phone number
      public static var email:String; // email

      // 一些共存照片資料
      public static var my_img:BitmapData;
      public static var friend_img:BitmapData;

      // --------------------- LINE ---------------------

      public static function get mgr():Progression { return getManagerById('root') || CastDocument.root.manager; }

      // 利用id來取得物件，只對CastMovieClip有效
      public static function get loading():MovieClip { return getInstanceById('MyLoader') as MovieClip; };

      // --------------------- LINE ---------------------

      /**
       * add/remove loading movieclip
       * @usage
         DEF.addLoading(stage, DEF.loading);
         DEF.removeLoading(stage, DEF.loading);
       */
      public static function addLoading(target:DisplayObjectContainer, loading_mc:DisplayObject):void
      {
         if (target && loading_mc)
         {
            new AddChild(target, loading_mc).execute();
         }
      }
      public static function removeLoading(target:DisplayObjectContainer, loading_mc:DisplayObject):void
      {
         if (target && loading_mc && target.contains(loading_mc))
         {
            new RemoveChild(target, loading_mc).execute();
         }
      }

      /**
       * Control Generic Pause/Resume MovieClip.
       * @usage
         DEF.stop(); // To stop all children inherited from GenericPauseResumeMovieClip
         DEF.play(); // To play all children inherited from GenericPauseResumeMovieClip
       */
      public static function stop():void { GenericPauseResumeMovieClip.stopAll(); }
      public static function play():void { GenericPauseResumeMovieClip.playAll(); }

      // --------------------- LINE ---------------------
		
	}

}